<include file="Admin:header" />
<load href="./Public/Js/swfupload.js"/>
<div id="msg"></div>
<form name="myform" id="myform" action="<if condition="$action_name=='add'">{:U($module_name.'/insert')}<else />{:U($module_name.'/update')}</if>" method="post">
<div id="filelist" class="hide"></div>
<div class="error"><ul></ul></div>

<table cellpadding=0 cellspacing=0 class="table_form" id="tableBody">
<tr id="firsttr" class="CaseRow">
	<td width="80">产品编码</td>
	<td width="120" id="box_ordersn">
		<select name="productname[]"  id="ordersn" validate=""  title="必选">
<volist name="stock" id="r">
			<option value="{$r['productcode']}" <if condition="$r['productcode'] ==$vo['productcode']">selected="selected"</if>>{$r['productcode']}</option>
</volist>
		</select>
	</td>
	<td width="50">数量</td>
	<td>
		<input type="text"   class="input-text " name="number[]"  id="number" value="1" size="5"  validate="" />
		<a onclick="AddRow();" href="#">增加一行</a>
	</td>
</tr>
	<tr>
		<td width="120">物流商名称</td>
        <td id="box_title">
		<select name="title"  id="title" validate=""  title="必选">
		<volist name="Logistics" id="r">
		<option value="{$r['id']}" <if condition="$r['title'] ==$vo['title']">selected="selected"</if>>{$r['title']}</option>
		</volist>
		</select>
		</td>
	</tr>
	<tr>
		<td width="120">价格</td>
        <td id="box_price">
		<input type="text"   class="input-text " name="price"  id="price" value="" size=""  validate="" /> 		</td>
	</tr>
	<tr>
		<td width="120">发货日期</td>
        <td id="box_shipmentdate">
		<input  class="Wdate input-text  "  validate=""   name="shipmentdate" type="text" id="shipmentdate" size="25" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'
		})" value="{$vo['shipmentdate']|todate='Y-m-d H:i:s'}" />		</td>
	</tr><tr>
		<td width="120">发货方式</td>
        <td id="box_shipmentmethod">
		<input type="text"   class="input-text " name="shipmentmethod"  id="shipmentmethod" value="{$vo['shipmentmethod']}" size=""  validate="" /> 		</td>
	</tr><tr>
		<td width="120">收货人姓名</td>
        <td id="box_consigneename">
		<input type="text"   class="input-text " name="consigneename"  id="consigneename" value="{$vo['consigneename']}" size=""  validate="" /> 		</td>
	</tr>
	<tr>
		<td width="120">经手人</td>
        <td id="box_handling">
		<input type="text"   class="input-text " name="handling"  id="handling" value="" size=""  validate="" /> 		</td>
	</tr>
	<tr>
		<td>同步出库</td>
        <td id="box_syn">
		<input type="checkbox" name="syn" id="syn" value="1" /> 		</td>
	</tr>
	<tr>
		<td width="120">发布时间</td>
        <td id="box_createtime">
		<input  class="Wdate input-text  "  validate=" required:true"   name="createtime" type="text" id="createtime" size="25" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'
		})" value="<?php echo date('Y-m-d H:i:s'); ?>" />		</td>
	</tr>
		</table>











		<div id="bootline"></div>
		<div id="btnbox" class="btn">
		<if condition="$vo['id']!=''"><input TYPE="hidden" name="id" value="{$vo.id}"></if>
		<INPUT TYPE="submit"  value="{:L('dosubmit')}" class="button" >
		<input TYPE="reset"  value="{:L('cancel')}" class="button">
		</div>
{__TOKEN__}
</form>
</div>
<script>
function   AddRow(){
	if($('.CaseRow').length>=2){
		newtr=document.getElementById('tableBody').insertRow(2);
	}else{
		newtr=document.getElementById('tableBody').insertRow(1);
	}
	newtr.className='CaseRow';
	var td = newtr.insertCell(0);
	td.innerHTML = "产品名称";
	var td = newtr.insertCell(1);
	td.innerHTML = $('#box_ordersn').html();
	var td = newtr.insertCell(2);
	td.innerHTML = "数量";
	var td = newtr.insertCell(3);
	if($('.CaseRow').length>2){
		td.innerHTML = '<input type="text"   class="input-text " name="number[]"  id="number" value="1" size="5"  validate="" />';
	}else{
		td.innerHTML = '<input type="text"   class="input-text " name="number[]"  id="number" value="1" size="5"  validate="" /><a onclick="RemoveRow(1);" href="#">移除一行</a>';
	}
}   

function   RemoveRow(index){ 
	document.getElementById('tableBody').deleteRow($('.CaseRow').length-1);
}
</script>